package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateProjectUpdateDTO;
import com.itlong.cloud.POJO.DTO.operate.PropertyFinanceManageGetPageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateGetProjectFinancePageVO;
import com.itlong.cloud.operate.service.IPropertyFinanceManageService;
import com.itlong.cloud.paymenthub.IPropertyFinanceManageClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <desc>
 *      运营-物业财务管理暴露接口实现类
 * <desc/>
 *
 * @createDate 2018/09/20
 */
@RestController
public class PropertyFinanceManageServiceResource implements IPropertyFinanceManageClient {

    @Autowired
    private IPropertyFinanceManageService iPropertyFinanceManageService;

    /**
     * <desc>
     *      物业财务管理-分页获取项目信息
     * </desc>
     *
     * @param propertyFinanceManageGetPageDTO 运营-物业财务管理项目列表查询DTO
     * @return 分页结果
     * @author wangzhi
     * @createDate 2018/09/20
     */
    @Override
    @PostMapping(path = "/operate/finance/getProjectFinancePage")
    public Page<OperateGetProjectFinancePageVO> getProjectFinancePage(@RequestBody PropertyFinanceManageGetPageDTO propertyFinanceManageGetPageDTO) throws Exception {
        return iPropertyFinanceManageService.getProjectFinancePage(propertyFinanceManageGetPageDTO);
    }

    /**
     * <desc>
     *      获取所有项目信息
     * </desc>
     *
     * @param propertyFinanceManageGetPageDTO 条件
     * @return 项目信息列表
     * @author wangzhi
     * @createDate 2018/09/20
     */
    @Override
    @PostMapping(path = "/operate/finance/getProjectFinanceList")
    public List<OperateGetProjectFinancePageVO> getProjectFinanceList(@RequestBody PropertyFinanceManageGetPageDTO propertyFinanceManageGetPageDTO) throws Exception {
        return iPropertyFinanceManageService.getProjectFinanceList(propertyFinanceManageGetPageDTO);
    }

    /**
     * <desc>
     *      财务启用或禁用项目
     * <desc/>
     *
     * @param updateDTO 项目更新信息
     * @return
     * @author wangzhi
     * @createDate 2018/10/24
     */
    @Override
    @RequestMapping(path = "/operate/finance/update", method = {RequestMethod.POST})
    public Integer updateProject(@RequestBody OperateProjectUpdateDTO updateDTO) throws Exception {
        return iPropertyFinanceManageService.updateProject(updateDTO);
    }
}
